import Vue from 'vue'
import VueRouter from 'vue-router'

import MyReg from '@/views/Reg/MyReg.vue'
import Login from '@/views/Login/Login.vue'
import Main from '@/views/Main/Main.vue'
import Home from '@/views/Menus/Home/Home.vue'
import UserInfo from '@/views/Menus/User/UserInfo.vue'
import Avatar from '@/views/Menus/User/UserAvatar.vue'
import userPwd from '@/views/Menus/User/UserPwd.vue'
import artcate from '@/views/Menus/article/ArtCate.vue'
import artList from '@/views/Menus/article/ArtList.vue'

Vue.use(VueRouter)

const routes = [
  { path: '/reg', component: MyReg }, { path: '/login', component: Login },
  {
    path: '/',
    component: Main,
    // 3. 开启路由重定向
    redirect: '/home',
    children: [
      // 2. home 作为 子路由规则
      { path: 'home', component: Home },
      { path: 'user-info', component: UserInfo },
      { path: 'user-avatar', component: Avatar },
      { path: 'user-Pwd', component: userPwd },
      { path: 'art-cate', component: artcate },
      { path: 'art-list', component: artList }
    ]
  }

]
const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
export default router
